#ifndef MECHVERSIONCLIENT_H
#define MECHVERSIONCLIENT_H
#include "CEvtVar.h"
#include "localTcpClient.h"
#include "logger.h"

typedef struct __mech_version_pose
{
    double p[6];
}MECH_VERSION_POSE;

enum MECH_POSE_TYPE
{
    MECH_POSE_TYPE_EYE_TO_HAND_NO_POSE =0,
    MECH_POSE_TYPE_EYE_IN_HAND,
    MECH_POSE_TYPE_EYE_IN_HAND_NO_POS,
    MECH_POSE_TYPE_EYE_TO_HAND,
};

class MechVersionClient
{
public:
    MechVersionClient();
    ~MechVersionClient();
    int init();
    void print_base_info();

    // 触发 mech-version工程(阻塞获取结果，需要放到工作线程中)
    int mm_cmd_run_version(int project_id,MECH_VERSION_POSE joint_pos,MECH_VERSION_POSE tcp_pose);
    int mm_cmd_receive_verion(int project_id,std::vector<MECH_VERSION_POSE>& poses);

private:
    // 连接 Mech-Version服务器
    localTcpClientSync mm_sync_client;
    int localPort = 50000;
    std::string localIP = "127.0.0.1";

    int mm_run_vis(int project_id,int except_pose,int vision_pose_type,MECH_VERSION_POSE joint,MECH_VERSION_POSE tcp_pose);
    int mm_receive_vis(int project_id, std::string &recv_array);
    int check_reply_cmd_status(char *data, int data_len, int cmd, int status);
    int parse_cmd_102_reply_str(std::string reply, std::vector<MECH_VERSION_POSE>& poses);

    inline std::string mech_version_pose_to_string(MECH_VERSION_POSE pose);
};

#endif // MECHVERSIONCLIENT_H
